---
title: TxtConverter
summary: API reference for TxtConverter.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-17
library: PdfAPI.SyncFusionCore
reference_type: package
---

# TxtConverter

`TxtConverter` is the [BaseConverter](../PdfAPI.Core.Convert/BaseConverter.md) subclass selected by `ConverterFactory` for `.txt` source files. It is the only converter that reads its source with an ASCII-only encoding and lays text out itself, drawing a fixed number of lines per page with a public field controlling that page density, rather than delegating to a dedicated Syncfusion document engine.

## Purpose
- Convert plain text to a paginated PDF by drawing fixed-size line blocks
  ([BR-SFC-003](../../business-rules.md#br-sfc-003-extension-to-converter-mapping), [BR-SFC-004](../../business-rules.md#br-sfc-004-text-converted-via-intermediate-pdf)).
- Read source text using an ASCII-only encoding, which can corrupt non-ASCII characters
  ([BR-SFC-012](../../business-rules.md#br-sfc-012-ascii-only-source-text-reading)).
- Expose the page density (lines per page) as a public, mutable field rather than a fixed constant
  ([BR-SFC-014](../../business-rules.md#br-sfc-014-fixed-40-lines-per-page-pagination)).
- Identify itself to `ConverterFactory` and downstream consumers as the `Text` conversion type.

## Context
- Namespace: `PdfAPI.SyncFusionCore`
- Assembly/package: `PdfAPI.SyncFusionCore` (`Pdf.Local.Client` NuGet package)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| TxtConverter | `TxtConverter()` | Creates a ready-to-use `TxtConverter` instance for `ConverterFactory` to invoke against plain-text source documents (`.txt`) as the first step of the intermediate-PDF conversion path; the constructor body is empty*, so no state is established beyond the base type's fields. |
| ConversionType | `override SourceConversionType ConversionType { get; }` | Returns `SourceConversionType.Text`, identifying this converter's source format to `ConverterFactory` and to the assembled `PdfResult`. |
| LinesPerPage | `public int LinesPerPage = 40` | Public field controlling how many lines of text are drawn per output page before starting a new page; defaults to 40 ([BR-SFC-014](../../business-rules.md#br-sfc-014-fixed-40-lines-per-page-pagination)). |

## Inherited public members

Members in this section are inherited from `BaseConverter` in `PdfAPI.SyncFusionCore`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| Convert | `PdfResult Convert(Stream stream, ConvertRequest request)` | Executes the full conversion: times the operation, invokes `ConfigureConverter` and `ConvertItem`, and assembles a `PdfResult` with `Status`, `Elapsed`, and `PdfProcessorType = Syncfusion`; captures rather than propagates conversion exceptions ([BR-SFC-006](../../business-rules.md#br-sfc-006-result-stamped-syncfusion-processor), [BR-SFC-010](../../business-rules.md#br-sfc-010-conversion-exceptions-captured-not-rethrown)). | `PdfAPI.SyncFusionCore` — `BaseConverter` |

## Behavioral notes
- Because the field is public and mutable, a caller with a direct reference to this converter
  instance could change page density before conversion; `ConverterFactory` always constructs a fresh instance, so the default of 40 is what actually executes on the standard conversion path.
- Reading the source with an ASCII-only encoding means characters outside the ASCII range may be
  altered or lost during conversion ([BR-SFC-012](../../business-rules.md#br-sfc-012-ascii-only-source-text-reading)).
- A conversion failure is captured by the inherited `Convert` method and reported through the
  result rather than thrown ([BR-SFC-010](../../business-rules.md#br-sfc-010-conversion-exceptions-captured-not-rethrown)).

## Constraints and usage notes
- Not intended to be constructed directly by application code; `ConverterFactory` constructs and
  invokes it based on the source file extension.
- Text typography (font/size) is fixed within the converter, not configurable via a public member
  ([BR-SFC-015](../../business-rules.md#br-sfc-015-fixed-text-typography)).

## Related documentation
- [API reference](../index.md)
- [Operations and processes](../../operations-processes.md)
- [Business rules](../../business-rules.md)

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- `PdfApi.SyncFusionCore\Convert\TxtConverter.cs`
